package com.example.edu.Controller;

import com.example.edu.Dto.PageDto;
import com.example.edu.Dto.Result;
import com.example.edu.Dto.UnionSearchDto;
import com.example.edu.Entity.Article;
import com.example.edu.Service.AllArticleService;
import com.example.edu.Service.ArticleService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/custom/allArticle")
public class AllArticleController {
    @Resource
    AllArticleService allArticleService;

    @Resource
    ArticleService articleService;

    @PostMapping("/suggest")
    public Result suggest(){
        return allArticleService.suggest();
    }

    @PostMapping("/search")
    public Result search(@RequestBody UnionSearchDto unionSearchDto){
        return allArticleService.search(unionSearchDto);
    }

    @PostMapping("/get")
    public Result get(Article articleId){
        return articleService.get(articleId);
    }

    @PostMapping("/getList")
    public Result getList(@RequestBody PageDto pageDto){
        return allArticleService.getList(pageDto);
    }

    @PostMapping("/getHot")
    public Result getHot(){
        return allArticleService.getHot();
    }

    @PostMapping("/getTags")
    public Result getTags(){
        return allArticleService.getTags();
    }
}
